home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d20
/
msgq160s.arc
/
P2C.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-26
|
1KB
|
48 lines
/*
* P2C.C - Pascal/C string conversion
*
* Msged/Q message editor for QuickBBS Copyright 1990 by P.J. Muller
*
* This file adapted from QMsg by Stig Jacobsen
*/
#include <string.h>
#include "p2c.h"
/* --- Convert a pascal string to a C string -------------------------- */
void pascal p2c_str (register char *str) {
register int c1;
c1 = str[0]; /* Save length */
memmove (str, &str[1], c1); /* Copy data part */
str[c1] = '\0'; /* Set length */
} /* p2c_str */
void pascal p2c_strn(char *str, int n)
{
int c1;
c1 = (str[0] > n ? n : str[0]);
memmove (str, &str[1], c1); /* Copy data part */
str[c1] = '\0'; /* Set length */
} /* p2c_strn */
/* --- Convert a C string to a pascal string -------------------------- */
void pascal c2p_str (register char *str) {
register int c1;
c1 = strlen(str); /* Save length */
memmove (&str[1], str, c1); /* Copy data part */
str[0] = c1; /* Set the length */
} /* p2c_str */
/* ----------------------- ### EOF ### -------------------------------- */